//
//  XQBluetoothSDK.h
//  XQBluetoothSDK
//
//  Created by 包月兴 on 16/6/20.
//  Copyright © 2016年 包月兴. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#pragma mark -----define----

#define XQBleSDKInstance [XQBluetoothSDK sharedInstance]
#define XQ_Ble_UDGetObj(KEY) [[NSUserDefaults standardUserDefaults] objectForKey:(KEY)]
#define XQ_Ble_UDSetObj(OBJ,KEY)  [[NSUserDefaults standardUserDefaults] setObject:(OBJ) forKey:(KEY)]; [[NSUserDefaults standardUserDefaults] synchronize]
#define XQ_Ble_UDDeleteObj(KEY)[[NSUserDefaults standardUserDefaults] removeObjectForKey:(KEY)];[[NSUserDefaults standardUserDefaults] synchronize]
#ifdef DEBUG // 调试
#define XQBLELog(fmt, ...) {NSLog((@"%s [Line %d] DEBUG:--->" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);}
#else       // 发布打包
#define XQBLELog(...)
#endif
extern NSString * const XQUSERId;
extern NSString * const SDKVER;
extern NSString * const APPID;
//蓝牙断开通知
extern NSString * const XQBLEDISCONNECTNOTI;
#pragma mark -----枚举状态定义----------------
///蓝牙功能开关
typedef NS_ENUM(NSInteger,XQBluetoothFunSwitch){
    ///开关关闭
    XQBluetoothFunSwitchClose = 0,
    ///开关打开
    XQBluetoothFunSwitchOpen,
};

/// 性别
typedef NS_ENUM(NSInteger,XQGenderType) {
    /// 女
    XQGenderTypeWoman = 0,
    /// 男
    XQGenderTypeMan,
};

/// 单位类型
typedef NS_ENUM(NSInteger,XQUnitType) {
    ///公制
    XQUnitTypeMetric = 0,
    ///英制
    XQUnitTypeImperial,
};

///蓝牙SDK授权错误码
typedef NS_ENUM(NSInteger,XQBluetoothAuthErrorCode){
    ///蓝牙SDK授权成功
    XQBluetoothAuthErrorCodeNo = 0,
    ///无效Appid或公钥或私钥
    XQBluetoothAuthErrorCodeInvalidAppidOrPubkeyOrPrivatekey,
    ///网络错误
    XQBluetoothAuthErrorCodeNetworkError,
    ///未知错误
    XQBluetoothAuthErrorCodeUnknownError,
};

///时钟模式
typedef NS_ENUM(NSInteger,XQClockMode) {
    XQClockModeTwenty = 0,  //24小时制
    XQClockModeTwelve,      //12小时制
};
///心率区间分段
typedef NS_ENUM(NSInteger,XQHeartSection){
    XQHeartSectionLow = 1,   //低区间
    XQHeartSectionNormal,    //正常区间
    XQHeartSectionExercise,  //运动区间
    XQHeartSectionAnaerobic, //无氧运动区间
    XQHeartSectionHigh,     //高区间
};

///设备连接状态
typedef NS_ENUM(NSInteger,XQBLEState){
    XQBLEStateDisconnected = 0, //未连接状态
    XQBLEStateConnecting,      //正在连接
    XQBLEStateConnected,       //已连接
    XQBLEStateDisconnecting,  //断开连接
};
///蓝牙错误码
typedef NS_ENUM(NSInteger,XQBluetoothErrorCode){
    ///未授权
    XQBluetoothErrorCodeNoAuthorization = 1,
    ///非法设备
    XQBluetoothErrorCodeunlawfulness,
    ///不支持蓝牙
    XQBluetoothErrorCodeNoSupportBluetooth,
    ///蓝牙未打开
    XQBluetoothErrorCodeBluetoothPoweredOff,
    ///蓝牙连接超时
    XQBluetoothErrorCodeBluetoothConnectedOut,
    ///蓝牙连接失败
    XQBluetoothErrorCodeBluetoothConnectFailure,
    ///外设不存在
    XQBluetoothErrorCodeNoPeripheral,
    ///蓝牙断链
    XQBluetoothErrorCodeDisConnect,
     ///未绑定设备
    XQBluetoothErrorCodeUnBind,
    ///绑定设备搜索失败
    XQBluetoothErrorCodeBindSearchFailure,
    ///写通道不存在
    XQBluetoothErrorCodeNotWrite,
    ///不支持同步个人信息协议
    XQBluetoothErrorCodeNoSupportPersonMessage,
    ///不支持同步震动次数协议
    XQBluetoothErrorCodeNoSupportSyncShakeTime,
    ///不支持同步断链提醒协议
    XQBluetoothErrorCodeNoSupportSyncDisconnectWarn,
    ///不支持同步拍照模式协议
    XQBluetoothErrorCodeNoSupportSyncPhotographMode,
    ///不支持打电话提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSCellPhone,
    ///不支持短信提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSMessage,
    ///不支持微信提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSWX,
    ///不支持QQ提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSQQ,
    ///不支持Facebook提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSFacebook,
    ///不支持Skype提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSLine,
    ///不支持Twitter提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSTwitter,
    ///不支持Whats提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSWhatsApp,
    ///不支持messager提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSMessager,
    ///不支持skype提醒协议
    XQBluetoothErrorCodeNoSupportSyncANCSSkype,
    ///不支持同步固件信息协议
    XQBluetoothErrorCodeNoSupportSyncFirmwareMessage,
    ///不支持同步闹钟协议
    XQBluetoothErrorCodeNoSupportSyncClock,
    ///不支持同步心率协议
    XQBluetoothErrorCodeNoSupportSyncHeart,
    ///不支持同步打开心率协议
    XQBluetoothErrorCodeNoSupportSyncOpenHeart,
    ///不支持同步关闭心率协议
    XQBluetoothErrorCodeNoSupportSyncCloseHeart,
    ///不支持同步精确协议
     XQBluetoothErrorCodeNoSupportSyncAccurateSleep,
    ///闹钟个数超出
    XQBluetoothErrorCodeClockNumberBeyond,
    ///不支持同步运动和睡眠详情
    XQBluetoothErrorCodeNoSupportSyncMovementAndSleepDetail,
    ///不支持同步运动目标协议
    XQBluetoothErrorCodeNoSupportSyncGoalStep,
    ///不支持抬手亮屏开关协议
    XQBluetoothErrorCodeNoSupportSyncBrightScreen,
    ///不支持同步时钟模式
    XQBluetoothErrorCodeNoSupportSyncClockMode,
    ///支持同步获取序列号协议
     XQBluetoothErrorCodeNoSupportSyncSerialNumber,
    ///固件下载失败
    XQBluetoothErrorCodeFirmwareDownloadFailure,
    ///固件路径错误
    XQBluetoothErrorCodeFirmwarePathFailure,
    ///固件不完整
    XQBluetoothErrorCodeFirmwareNoIncomplete
    
    
};
@interface  XQBluetoothError:NSError
-(instancetype)initWitheErrorCode:(XQBluetoothErrorCode)code;
@end

#pragma mark ----定义动态功能block---

/**
 *  总步数
 *
 *  @param steps 步数
 */
typedef void (^XQBleTotalSteps)(NSInteger steps);

/**
 *  跑步总步数
 *
 *  @param step 步数
 */
typedef void (^XQBleRunSteps)(NSInteger steps);

/**
 *  总里程
 *
 *  @param distance 里程(单位:米)
 */
typedef void (^XQBleTotalDistance)(NSInteger distance);

/**
 *  消耗总卡路里
 *
 *  @param calorie 总卡路里(单位:大卡)
 */
typedef void (^XQBleTotalCalorie)(NSInteger calorie);

/**
 *  获取睡眠时长(秒)
 *
 *  @param duration 睡眠时长
 */
typedef void (^XQBleTotalSleep)(NSInteger duration);


/**
 *  电量百分比
 *
 *  @param percent 百分比
 */
typedef void (^XQBleElectric)(NSInteger percent,BOOL isCharging);

/**
 *  找手机
 */
typedef void (^XQBleFindCellphone)(void);

/**
 *  照相
 */
typedef void (^XQBlePhotograph)(void);

/**
 *  蓝牙信号强度
 *
 *  @param XQBleRSSI 信号强度
 */
typedef void (^XQBleRSSI)(NSInteger rssi);
/**
 *  时时心率
 *
 *  @param heart 心率
 */

typedef void (^XQBleHeart)(NSInteger heart,XQHeartSection section);
/**
 *  蓝牙错误
 *
 *  @param error 错误码
 */
typedef void (^XQBleFailure)(XQBluetoothError *error);
typedef void (^XQSearchPeripheralDictionary)( NSDictionary * peripheral);
typedef void (^XQSearchPeripheralArray)(NSArray * peripherals);

@interface XQBluetoothSDK : NSObject
///总步数Block
@property (nonatomic,weak) XQBleTotalSteps totalStepsBlock;
@property (nonatomic,weak) XQBleRunSteps runStepsBlock;
///总里程Block
@property (nonatomic,weak) XQBleTotalDistance totalDistanceBlock;
///消耗总卡路里Block
@property (nonatomic,weak) XQBleTotalCalorie totalCalorieBlock;
///获取睡眠时长(秒)
@property (nonatomic,weak) XQBleTotalSleep totalSleepBlock;
///电量百分比变化Block
@property (nonatomic,weak) XQBleElectric electricBlock;
///找手机Block
@property (nonatomic,weak) XQBleFindCellphone findCellphoneBlock;
///照相Block
@property (nonatomic,weak) XQBlePhotograph photographBlock;
///信号强度变化Block
@property (nonatomic,weak) XQBleRSSI rssiBlock;

+ (instancetype)sharedInstance;
/**
 *  蓝牙SDK注册
 *
 *  @param appid       appid
 *  @param pubkey      公钥
 *  @param privatekey  私钥
 *  @param compeletion 注册完成
 */
- (void)registerWithAppid:(NSString *)appid
                   pubkey:(NSString *)pubkey
                    privatekey :(NSString *)privatekey
              compeletion:(void(^)(XQBluetoothAuthErrorCode errorCode,NSString *message))compeletion;

/**
 *  注册用户id
 *
 *  @param userId 用户id
 */
-(void)registerUserId:(NSString *)userId;
/**
 设置具体一天睡眠查询区间(默认是17:00~~17:00,0~1440)

 @param startTime    开始时间
 @param endTime 结束时间
 */
-(void)setSelectSleepSectionWithStartTime:(NSInteger)startTime
                                  endTime:(NSInteger)endTime;
/**
 *  搜索设备
 *
 *  @param duration             搜索时长(时长为0一直进行搜索,再连接设备之前需要停止搜索)
 *  @param peripheralDictionary 扫描到一个设备就返回已经扫描到所有外设信息字典(@{@”peripheral”: CBPeripheral对象,@”RSSI”:蓝牙信号强度,@"uuid":设备uuid(NSString),@"name":设备类型,@"address":设备mac地址})
 *  @param peripheralArray      扫描结束返回所有的外设数组(@[@{@”peripheral”: CBPeripheral对象,@”RSSI”:蓝牙信号强度,@"uuid":设备uuid(NSString),@"name":设备类型,@"address":设备mac地址}])
 *  @param failure              搜索失败错误信息
 */
-(void)searchPeripheralWithDuration:(NSInteger )duration
               peripheralDictionary:(XQSearchPeripheralDictionary)peripheralDictionary peripheralArray:( XQSearchPeripheralArray)peripheralArray
                            failure:( XQBleFailure)failure;
/**
 *  停止搜索
 */
-(void)stopScan;

/**
 * 获取设备连接状态
 */
-(XQBLEState)gainBleState;

/**
 * 未绑定连接外设
 *
 *  @param duration   连接时长(单位:s)
 *  @param peripheral 外设对象
 *  @param success    连接成功
 *  @param failure    连接失败
 */
-(void)connectPeripheralWithDuration:(NSInteger )duration
                          peripheral:(CBPeripheral *)peripheral
                             success:(void(^)())success
                             failure:(XQBleFailure)failure;
/**
 *  绑定外设
 *
 *  @param peripheral 外设
 *  @param Complete 同步运动、睡眠和心率数据完成
 *  @param syncFailure 同步运动、睡眠和心率数据失败
 */
-(void)bindWithPeripheral:(CBPeripheral *)peripheral
             syncComplete:(void(^)())complete
              syncFailure:(XQBleFailure)syncFailure;

/**
 *  同步睡眠时间段设置
 *
 *  @param moonStartHour  中午开始小时
 *  @param moonStartMin   中午开始分钟
 *  @param moonEndHour    中午结束小时
 *  @param moonEndMin     中午结束分钟
 *  @param nightStartHour 晚上开始小时
 *  @param nightStartMin  晚上开始分钟
 *  @param nightEndHour   晚上结束小时
 *  @param nightEndMin    晚上结束分钟
 *  @param success        成功
 *  @param failure        失败
 */
-(void)syncSleepTimeIntervalWithMoonStartHour:(NSInteger)moonStartHour
                                 moonStartMin:(NSInteger)moonStartMin
                                  moonEndHour:(NSInteger)moonEndHour
                                   moonEndMin:(NSInteger)moonEndMin
                               nightStartHour:(NSInteger)nightStartHour
                                nightStartMin:(NSInteger)nightStartMin
                                 nightEndHour:(NSInteger)nightEndHour
                                  nightEndMin:(NSInteger)nightEndMin
                                      success:(void(^)())success
                                      failure:(XQBleFailure)failure;
/**
 *  已绑定连接外设
 *
 *  @param duration 连接时长(单位:s)
 *  @param success  连接成功
 *  @param failure  连接失败
 *  @param Complete    同步运动、睡眠和心率数据完成
 *  @param syncFailure 同步运动、睡眠和心率数据失败
 */
-(void)connectBindedPeripheralWithDuration:(NSInteger )duration
                                   success:(void(^)()) success
                                   failure:(XQBleFailure)failure
                              syncComplete:(void(^)())complete
                               syncFailure:(XQBleFailure)syncFailure;

/**
 *
 * 开启设备蓝牙信号强度反馈
 *  @param duration 设置蓝牙信号强度反馈时间间隔(建议60秒以上，单位:秒)
 */
-(void)startBleRSSIWithDuration:(NSInteger)duration
                        failure:(XQBleFailure)failure;


/**
 *  停止蓝牙设备型号强度反馈
 */
-(void)stopBleRSSI;

/**
 *  判断是否是最新固件
 *
 *  @return 是/否
 * 备注：如果是否的话，可以采用升级进行升级
 */
-(BOOL)judgeIsLastFirmware;

/**
 *  解绑
 */
-(void)unbind;

/**
 *  固件升级
 *
 *  @param progress   升级进度
 *  @param no    无最新固件
 *  @param success    升级成功
 *  @param failure    升级失败
 */
-(void)upgradeWithProgress:(void (^)(int progress))progress
                        no:(void(^)())no
             success:(void(^)())success
             failure:(XQBleFailure)failure;



/**
 *  固件升级
 *
 *  @param path        固件本地路径
 *  @param progress    升级进度
 *  @param success    升级成功
 *  @param failure    升级失败
 */
-(void)upgradeWithFirmarePath:(NSString *)path
                     progress:(void (^)(int progress))progress
                      success:(void(^)())success
                      failure:(XQBleFailure)failure;


/**
 *  同步个人信息
 *
 *  @param genderType 性别
 *  @param age        年龄
 *  @param height     身高(cm)
 *  @param weight     体重(kg)
 *  @param unitType   单位(默认公制)
 *  @param success    成功
 *  @param failure    失败
 */
-(void)syncPersonMessageWithGenderType:(XQGenderType)genderType
                                   age:(NSInteger)age
                                height:(NSInteger)height
                                weight:(NSInteger)weight
                              unitType:(XQUnitType)unitType
                               success:(void(^)())success
                               failure:(XQBleFailure)failure;
/**
 *  同步运动目标
 *
 *  @param goalStep 运动目标
 *  @param success  成功
 *  @param failure  失败
 */
-(void)syncGoalStep:(NSInteger)goalStep
            success:(void(^)())success
            failure:(XQBleFailure)failure;
/**
 *  同步震动次数
 *
 *  @param time    次数(1~10)
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncShakeTimeWithTime:(NSInteger)time success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步断链提醒
 *
 *  @param type    提醒
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncDisconnectWarnWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步拍照模式
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncPhotographModeWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步电话提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSCellPhoneWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步短信提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSMessageWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步微信提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSWXWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步QQ提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSQQWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步Facebook提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSFacebookWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步Line提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSLineWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步Twitter提醒
 *
 *  @param type    开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSTwitterWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 * 同步WhatsApp提醒
 *
 *  @param type     开关
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncANCSWhatsAppWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 同步skype提醒
 @param type    开关
 @param success 成功
 @param failure 失败
 */
-(void)syncANCSSkypeWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;



/**
 同步messager提醒
 @param type    开关
 @param success 成功
 @param failure 失败
 */
-(void)syncANCSMessagerWithType:(XQBluetoothFunSwitch)type success:(void(^)())success failure:(XQBleFailure)failure;

/**
 *  同步固件信息
 *
 *  @param success 成功(firmwareVersion:固件版本)
 *  @param failure 失败
 */
-(void)syncFirmwareMessageWithSuccess:(void(^)(NSInteger firmwareVersion,BOOL isDress))success failure:(XQBleFailure)failure;

/**
 *  同步闹钟
 *
 *  @param number        闹钟编号
 *  @param type          开关
 *  @param hour          闹钟小时
 *  @param min           闹钟分钟
 *  @param sundayOpen    星期天闹钟是否打开
 *  @param mondayOpen    星期一闹钟是否打开
 *  @param tuesdayOpen   星期二闹钟是否打开
 *  @param wednesdayOpen 星期三闹钟是否打开
 *  @param thursdayOpen  星期四闹钟是否打开
 *  @param fridayOpen    星期五闹钟是否打开
 *  @param saturdayOpen  星期六闹钟是否打开
 *  @param isOnce        是否单次
 *  @param success       成功
 *  @param failure       失败
 */
-(void)syncClockWithNumber:(NSInteger)number
                 clockType:(XQBluetoothFunSwitch)type
                 clockHour:(NSInteger)hour
                  clockMin:(NSInteger)min
              isSundayOpen:(BOOL)sundayOpen
              isMondayOpen:(BOOL)mondayOpen
             isTuesdayOpen:(BOOL)tuesdayOpen
           isWednesdayOpen:(BOOL)wednesdayOpen
            isThursdayOpen:(BOOL)thursdayOpen
              isFridayOpen:(BOOL)fridayOpen
            isSaturdayOpen:(BOOL)saturdayOpen
                    isOnce:(BOOL)isOnce
                   success:(void(^)())success
                   failure:(XQBleFailure)failure;


/**
 同步事件
 
 @param number        编号
 @param text          推送文案
 @param type          开关
 @param hour          闹钟小时
 @param min           闹钟分钟
 @param sundayOpen    星期天闹钟是否打开
 @param mondayOpen    星期一闹钟是否打开
 @param tuesdayOpen   星期二闹钟是否打开
 @param wednesdayOpen 星期三闹钟是否打开
 @param thursdayOpen  星期四闹钟是否打开
 @param fridayOpen    星期五闹钟是否打开
 @param saturdayOpen  星期六闹钟是否打开
 @param success       成功
 @param failure       失败
 */
-(void)syncEventWithNumber:(NSInteger)number
                      text:(NSString *)text
                 clockType:(XQBluetoothFunSwitch)type
                 clockHour:(NSInteger)hour
                  clockMin:(NSInteger)min
              isSundayOpen:(BOOL)sundayOpen
              isMondayOpen:(BOOL)mondayOpen
             isTuesdayOpen:(BOOL)tuesdayOpen
           isWednesdayOpen:(BOOL)wednesdayOpen
            isThursdayOpen:(BOOL)thursdayOpen
              isFridayOpen:(BOOL)fridayOpen
            isSaturdayOpen:(BOOL)saturdayOpen
                    isOnce:(BOOL)isOnce
                   success:(void(^)())success
                   failure:(XQBleFailure)failure;
/**
 *  同步久坐时长
 *
 *  @param time     时长
 *  @param startHour 开始小时
 *  @param startMin  开始分钟
 *  @param endHour   结束小时
 *  @param endMin    结束分钟
 *  @param success   成功
 *  @param failure   失败
 */
-(void)syncSedentarinessWithTime:(NSInteger)time
                       startHour:(NSInteger)startHour
                        startMin:(NSUInteger)startMin
                         endHour:(NSInteger)endHour
                          endMin:(NSInteger)endMin
                         success:(void(^)())success
                         failure:(XQBleFailure)failure;
/**
 *  同步运动详情
 *
 *  @param success  成功
 *  @param failure  失败
 */
-(void)syncMovementWithSuccess:(void(^)())success
                        failure:(XQBleFailure)failure;

/**
 *  同步心率详情
 *
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncHearRateWithSuccess:(void(^)())success
                       failure:(XQBleFailure)failure;

/**
 *  同步打开心率
 *
 *  @param duration 打开心率持续时间
 *  @param constantlyHeart  时时心率
 *  @param success 成功
 *  @param failure  失败
 */
-(void)syncOpenHeartWithDuration:(NSInteger)duration
                         constantlyHeart:(XQBleHeart)constantlyHeart
                         success:(void(^)())success
                         failure:(XQBleFailure)failure;

/**
 *  同步关闭心率
 *
 *  @param success 成功
 *  @param failure 失败
 */
-(void)syncCloseHeartWithSuccess:(void(^)())success
                         failure:(XQBleFailure)failure;

/**
 *  定时心率测量设置
 *
 *  @param type      开关
 *  @param startHour 开始小时
 *  @param startMin  开始分钟
 *  @param endHour   结束小时
 *  @param endMin    结束分钟
 *  @param success   成功
 *  @param failure   失败
 *备注:每隔15分钟测量2分钟心率,一般设置睡眠时间段21：00~09：00,测量时间是:21:00~21:02、21:15~21:17.....,绑定后设备进行设置,请參考Demo
 */
-(void)syncTimingMeasurementHeartWithType:(XQBluetoothFunSwitch)type
                  startHour:(NSInteger)startHour
                   startMin:(NSInteger)startMin
                    endHour:(NSInteger)endHour
                     endMin:(NSInteger)endMin
                    success:(void(^)())success
                    failure:(XQBleFailure)failure;

/**
 *  抬手亮屏开关
 *
 *  @param funSwitch 开关
 *  @param success   成功
 *  @param failure   失败
 */
-(void)syncBrightScreenWithSwitch:(XQBluetoothFunSwitch)funSwitch
                          success:(void(^)())success
                          failure:(XQBleFailure)failure;
/**
 *  重置设备
 */
-(void)syncReset;
/**
 同步时钟模式

 @param clockMode 时钟模式
 @param success   成功
 @param failure  失败
 */
-(void)syncClockMode:(XQClockMode)clockMode
             success:(void(^)())success
             failure:(XQBleFailure)failure;
/**
 同步获取序列号

 @param success 成功
 @param failure 失败
 */
-(void)syncSerialNumberWithSuccess:(void(^)(NSString *serialNumber))success
                           failure:(XQBleFailure)failure;

/**
查询电量

@param success 查询成功
@param failure 查询失败
*/
-(void)syncSelectElectricWithSuccess:(XQBleElectric)success
                             failure:(XQBleFailure)failure;
/**
 *  退出登录
 */
-(void)loginOut;

@end
